from wtforms import Form, StringField, validators, ValidationError


# 初始化账号表单验证
class InitializeAdminForm(Form):
    password = StringField(
        validators=[
            validators.DataRequired(message='请输入密码'),
            validators.Length(min=5, max=20, message='请输入5-20位密码')
        ]
    )


class LoginForm(Form):
    # 账号的表单验证
    username = StringField(validators=[
        validators.DataRequired(message='请输入账号'),
        validators.Length(min=5, max=20, message='请输入账号5-20位账号')
    ])
    # 密码的表单验证
    password = StringField(validators=[
        validators.DataRequired(message='请输入密码'),
        validators.Length(min=5, max=20, message='请输入账号5-20位密码')
    ])
